
Partial Class SAD_SADInstall
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack = True _
            AndAlso Request.Form(cmdInstall.UniqueID) > "" Then

            Dim sConnection As String = ConfigurationManager.AppSettings("MetaData") & ";Application Name=SQLAutoDoc"

            Dim oInstall As New SADInstall.Install
            Dim iErrorCount As Integer = 0
            oInstall.CreateSchema(sConnection, iErrorCount)

            If iErrorCount = 0 Then
                HttpContext.Current.Response.Write("<br/>Schema Build Complete. Transferring to SQLAutoDoc in 5 seconds.")
                HttpContext.Current.Response.Flush()

                '---Set name of web server, for emails
                Dim oConfig As New SQLAutoDocLib.Config_Factory
                oConfig.SetValueFromName( _
                                "ROOT_URL", _
                                Session("ServerName") & ":" & Request.ServerVariables("server_port") & Request.ApplicationPath)

                Dim cs As ClientScriptManager = Page.ClientScript
                cs.RegisterStartupScript(Me.GetType(), "Transfer", "ReturnToDefault();", True)
            End If
        End If
    End Sub
End Class
